#效果极差
#Python实现将excel文件转化为html文件
#https://www.cnblogs.com/zyj3955/p/15534485.html
#https://blog.csdn.net/weixin_61745097/article/details/125271937
#https://www.cnblogs.com/xiongsheng/p/16462934.html
#pip --default-timeout=100 install pandas -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
#pip install openpyxl -i http://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com
import pandas as pd
import codecs

pd.set_option('display.width', 1000)
pd.set_option('colheader_justify', 'center')
xd = pd.ExcelFile('D:\\export_tmp\\甘特图模板.xlsx')
df = xd.parse()

pd.set_option('colheader_justify', 'center')

#设置html文件格式
html_string = '''
<!DOCTYPE html>
  <head>
  <meta charset="UTF-8">
  <title></title>
  </head>
  <link rel="stylesheet" type="text/css" href="df_style.css"/>
  <body>
    {table}
  </body>
</html>.
'''
with open('D:\\export_tmp\\table_2018.html', encoding='utf-8', mode='w') as f:
    f.write(html_string.format(table=df.to_html()))